<!DOCTYPE html>
<html lang="en-us">
<head><head>
    <meta name="google-site-verification" content="9vIieCe-Qpd78QOmBl63rGtIVbhY6sYyuxX3j8XWBA4" />
    <meta name="baidu-site-verification" content="LRrmH41lz7" />
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="google-site-verification" content="xBT4GhYoi5qRD5tr338pgPM5OWHHIDR6mNg1a3euekI" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <meta name="description" content="ceph从入门到放弃---ceph简介">
    
    <meta name="keyword"  content=", , 马少勋的网络日志, 马少勋的博客, Mashaoxun Blog, 博客, 个人网站, 互联网, Web, 云原生, PaaS, Istio, Kubernetes, 微服务, Microservice">
    <link rel="shortcut icon" href="/blog/img/favicon.ico">

    <title>ceph简介-马少勋的博客 | MaShaoXun Blog</title>

    <link rel="canonical" href="/blog/2019/01/29/ceph-profile/">

    <link rel="stylesheet" href="/blog/css/iDisqus.min.css"/>
	
    
    <link rel="stylesheet" href="/blog/css/bootstrap.min.css">

    
    <link rel="stylesheet" href="/blog/css/hux-blog.min.css">

    
    <link rel="stylesheet" href="/blog/css/syntax.css">

    
    <link rel="stylesheet" href="/blog/css/zanshang.css">

    
    <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    
    
    <script src="/blog/js/jquery.min.js"></script>
    
    
    <script src="/blog/js/bootstrap.min.js"></script>
    
    
    <script src="/blog/js/hux-blog.min.js"></script>
	
    
    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/github.min.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/dockerfile.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/vim.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/yaml.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/go.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/bash.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/shell.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/languages/nginx.min.js"></script>
    <script>hljs.initHighlightingOnLoad();</script>
</head>
</head>

<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">Mashaoxun Blog</a>
        </div>

        
        
        <div id="huxblog_navbar">
            <div class="navbar-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="/blog">Home</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/django">django</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/docker">docker</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/k8s">k8s</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/redis">redis</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/swarm">swarm</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/%E5%AD%98%E5%82%A8">存储</a>
                    </li>
                    
                    <li>
                        <a href="/blog/categories/%E7%9B%91%E6%8E%A7">监控</a>
                    </li>
                    
                    
		    
                        <li><a href="/blog/top/about/">ABOUT</a></li>
                    

                    
		    <li>
                        <a href="/blog/search">SEARCH <img src="/blog/img/search.png" height="15" style="cursor: pointer;"></a>
		    </li>
                    
                </ul>
            </div>
        </div>
        
    </div>
    
</nav>
<script>
    
    
    
    var $body   = document.body;
    var $toggle = document.querySelector('.navbar-toggle');
    var $navbar = document.querySelector('#huxblog_navbar');
    var $collapse = document.querySelector('.navbar-collapse');

    $toggle.addEventListener('click', handleMagic)
    function handleMagic(e){
        if ($navbar.className.indexOf('in') > 0) {
        
            $navbar.className = " ";
            
            setTimeout(function(){
                
                if($navbar.className.indexOf('in') < 0) {
                    $collapse.style.height = "0px"
                }
            },400)
        }else{
        
            $collapse.style.height = "auto"
            $navbar.className += " in";
        }
    }
</script>




<style type="text/css">
    header.intro-header {
        background-image: url('/blog/img/youyou.jpg')
    }
</style>
<header class="intro-header">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="post-heading">
                    <div class="tags">
                        
                        <a class="tag" href="/blog/tags/%E5%AD%98%E5%82%A8" title="存储">
                            存储
                        </a>
                        
                        <a class="tag" href="/blog/tags/ceph" title="ceph">
                            ceph
                        </a>
                        
                    </div>
                    <h1>ceph简介</h1>
                    <h2 class="subheading"></h2>
                    <span class="meta">
			Posted by 
			
			         &#34;马少勋&#34;
			 
			on 
			Tuesday, January 29, 2019
                        
                    </span>
                </div>
            </div>
        </div>
    </div>
</header>




<article>
    <div class="container">
        <div class="row">

            
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                post-container">

                
                <header>
                    <h2>TOC</h2>
                </header>
                <nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="#ceph组件介绍">ceph组件介绍</a></li>
<li><a href="#ceph原理介绍">ceph原理介绍。</a></li>
<li><a href="#存储原理">存储原理</a></li>
<li><a href="#ceph存储原理图">ceph存储原理图</a></li>
</ul></li>
</ul>
</nav>
                
                

<p><img src="http://www.mashaoxun.com/img/ceph.jpeg"  height="300" width="450"></p>

<h2 id="ceph组件介绍">ceph组件介绍</h2>

<ul>
<li>Ceph monitors(MON):Ceph监视器通过保存集群状态的映射来跟踪整个集群的健康状况(一般情况下一台宿主机一个mon进程，mon进程数量最好是奇数)</li>
<li>Ceph metadata server (MDS): MDS跟踪文件层次结构，仅为Ceph FS文件系统存储元数据</li>
<li>Ceph对象存储设备(OSD): 一旦应用程序向Ceph集群发出写操作，数据就以对象的形式存储在OSD中。一个OSD守护进程绑定到集群中的一个物理磁盘(通常ceph集群中物理磁盘的总数与在每个物理磁盘上存储用户数据的OSD守护进程的总数相同)</li>
<li>RADOS: RADOS负责存储这些对象，而不管它们的数据类型如何。RADOS层确保数据始终保持一致。为此，它执行数据复制、故障检测和恢复，以及跨集群节点的数据迁移和再平衡</li>
<li>Librados: librados库是一种访问RADOS的方便方法(接口形式访问ceph)</li>
<li>RBD:提供持久块存储，它是瘦配置的、可调整大小的，并在多个osd上存储数据条带。RBD服务被构建为一个在librados之上的本机接口。</li>
<li>RGW:RGW提供对象存储服务。在librados之上的本机接口。</li>
<li>CephFS: Ceph文件系统提供了一个符合posix标准的文件系统。在librados之上的本机接口。</li>
<li>Ceph manager: Ceph manager守护进程(Ceph -mgr)是在Kraken版本中引入的，它与monitor守护进程一起运行，
为外部监视和管理系统提供额外的监视和接口。</li>
</ul>

<h2 id="ceph原理介绍">ceph原理介绍。</h2>

<ul>
<li>存储文件被分片，每一个数据块是一个对象，对象保存在不同的服务器上，当节点失效，自动迁移数据，重新复制副本。</li>
<li>mds元数据服务器，只有当ceph做为文件系统存储数据时候才需要使用。</li>
<li>至少需要一个monitor(node节点)和两个osd守护进程。</li>
<li>osd作用：<br />
1.存储数据，处理数据复制，恢复，回填，均衡。<br />
2.通过其他osd守护进程心跳向monitor提供监控信息。<br />
3.当你设置osd 有2个副本的时候，至少需要2个osd守护进程，才能达到active+clean状态，osd默认三个副本。</li>
<li>monitor维护集群的状态的各种图表,包括监视图,osd图等。</li>
</ul>

<h2 id="存储原理">存储原理</h2>

<ul>
<li>存储的文件数据归类为对象object</li>
<li>对象放在对应的池子(pool)里</li>
<li>一个对象有若干个pg</li>
<li>一个pg有若干个osd</li>
<li>一个osd对应一块磁盘</li>
</ul>

<h2 id="ceph存储原理图">ceph存储原理图</h2>

<p><img src="http://www.mashaoxun.com/img/cephyuanli.png" alt="ceph" /></p>


                
                
<div class="entry-shang text-center">
    
	    <p>「真诚赞赏，手留余香」</p>
	
	<button class="zs show-zs btn btn-bred">赞赏支持</button>
</div>
<div class="zs-modal-bg"></div>
<div class="zs-modal-box">
	<div class="zs-modal-head">
		<button type="button" class="close">×</button>
		<span class="author"><a href="https://masxhub.gitee.io/blog"><img src="/blog/img/favicon.png" />Mashaoxun Blog</a></span>
        
	        <p class="tip"><i></i><span>真诚赞赏，手留余香</span></p>
		
 
	</div>
	<div class="zs-modal-body">
		<div class="zs-modal-btns">
			<button class="btn btn-blink" data-num="2">2元</button>
			<button class="btn btn-blink" data-num="5">5元</button>
			<button class="btn btn-blink" data-num="10">10元</button>
			<button class="btn btn-blink" data-num="20">20元</button>
			<button class="btn btn-blink" data-num="50">50元</button>
			<button class="btn btn-blink" data-num="100">100元</button>
		</div>
		<div class="zs-modal-pay">
			<button class="btn btn-bred" id="pay-text">2元</button>
			<p>使用<span id="pay-type">微信</span>扫描二维码完成支付</p>
			<img src="/blog/img/reward/zanshang.jpg"  id="pay-image"/>
		</div>
	</div>
	<div class="zs-modal-footer">
		<label><input type="radio" name="zs-type" value="wechat" class="zs-type" checked="checked"><span ><span class="zs-wechat"><img src="/blog/img/reward/wechat-btn.png"/></span></label>
		<label><input type="radio" name="zs-type" value="alipay" class="zs-type" class="zs-alipay"><img src="/blog/img/reward/alipay-btn.png"/></span></label>
	</div>
</div>
<script type="text/javascript" src="/blog/js/reward.js"></script>

                

                <hr>
                <ul class="pager">
                    
                    <li class="previous">
                        <a href="2020/02/24/redis/" data-toggle="tooltip" data-placement="top" title="redis维护">&larr;
                            Previous Post</a>
                    </li>
                    
                    
                    <li class="next">
                        <a href="2019/01/30/ceph-install/" data-toggle="tooltip" data-placement="top" title="ceph安装">Next
                            Post &rarr;</a>
                    </li>
                    
                </ul>

                
<div id="disqus-comment"></div>



            </div>
            
            <div class="
                col-lg-8 col-lg-offset-2
                col-md-10 col-md-offset-1
                sidebar-container">

                
                
                <section>
                    <hr class="hidden-sm hidden-xs">
                    <h5><a href="/tags/">FEATURED TAGS</a></h5>
                    <div class="tags">
                        
                        
                        
                        <a href="/blog/tags/ceph" title="ceph">
                            ceph
                        </a>
                        
                        
                        
                        
                        
                        <a href="/blog/tags/docker" title="docker">
                            docker
                        </a>
                        
                        
                        
                        <a href="/blog/tags/k8s" title="k8s">
                            k8s
                        </a>
                        
                        
                        
                        
                        
                        
                        
                        
                        
                        <a href="/blog/tags/%E5%AD%98%E5%82%A8" title="存储">
                            存储
                        </a>
                        
                        
                        
                        <a href="/blog/tags/%E7%9B%91%E6%8E%A7" title="监控">
                            监控
                        </a>
                        
                        
                        
                        
                    </div>
                </section>
                

                
                
                <section>
                    <hr>
                    <h5>FRIENDS</h5>
                    <ul class="list-inline">
                        
                        <li><a target="_blank" href="http://www.zrq.org.cn">瑞卿博客</a></li>
                        
                    </ul>
                </section>
                
            </div>
        </div>
    </div>
</article>




<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                   
                    
                    <li>
                        <a href="mailto:youremail@gmail.com">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-envelope fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
		    
                    
                    
                    
                    

                    

		    
                    
                    <li>
                        <a target="_blank" href="/blog/img/404.jpeg">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-wechat fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
		    
                    
                    <li>
                        <a target="_blank" href="https://github.com/yourgithub">
                            <span class="fa-stack fa-lg">
                                <i class="fa fa-circle fa-stack-2x"></i>
                                <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                            </span>
                        </a>
                    </li>
		    
                    
                    
                </ul>
		<p class="copyright text-muted">
                    Copyright &copy; Mashaoxun Blog , 2019
                    <br>
                    <a href="https://themes.gohugo.io/hugo-theme-cleanwhite">CleanWhite Hugo Theme</a> by <a href="https://zhaohuabing.com">Huabing</a> |
                    <iframe
                        style="margin-left: 2px; margin-bottom:-5px;"
                        frameborder="0" scrolling="0" width="100px" height="20px"
                        src="https://ghbtns.com/github-btn.html?user=zhaohuabing&repo=hugo-theme-cleanwhite&type=star&count=true" >
                    </iframe>
                </p>
            </div>
        </div>
    </div>
</footer>




<script>
    function async(u, c) {
      var d = document, t = 'script',
          o = d.createElement(t),
          s = d.getElementsByTagName(t)[0];
      o.src = u;
      if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
      s.parentNode.insertBefore(o, s);
    }
</script>






<script>
    
    if($('#tag_cloud').length !== 0){
        async("/js/jquery.tagcloud.js",function(){
            $.fn.tagcloud.defaults = {
                
                color: {start: '#bbbbee', end: '#0085a1'},
            };
            $('#tag_cloud a').tagcloud();
        })
    }
</script>


<script>
    async("https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.js", function(){
        var $nav = document.querySelector("nav");
        if($nav) FastClick.attach($nav);
    })
</script>


<script>
    (function(){
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https'){
       bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
      }
      else{
      bp.src = 'http://push.zhanzhang.baidu.com/push.js';
      }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>







</body>
</html>
